package com.chixing.controller;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 订单消息队列配置类
 */
@Configuration
public class TemplateKillMq {

    //交换机
    @Bean
    public DirectExchange templateKillExchange(){
        return new DirectExchange("templateKillExchange",true,false);
    }

    //死信队列
    @Bean
    public Queue templateKillQueue(){
        return new Queue("templateKillQueue",true,false,false);
    }

    //绑定
    @Bean
    public Binding bindingTemplateKill(){
        return BindingBuilder.bind(templateKillQueue()).to(templateKillExchange()).with("templateKillKey");
    }
}

